package com.chaochis.springboottestdemo.controller;

import com.chaochis.springboottestdemo.base.ApiResult;
import com.chaochis.springboottestdemo.model.queryParam.LogParam;
import com.chaochis.springboottestdemo.service.LogService;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("log")
@RequestMapping("/log")
public class LogController {

  private final LogService logService;

  public LogController(LogService logService) {
    this.logService = logService;
  }

  @GetMapping("/getList")
  public ApiResult getUserList(LogParam logParam){
    var list = this.logService.getAllList(logParam);
    var pageInfo = new PageInfo<>(list);
    return ApiResult.ok(pageInfo.getList());
  }
}
